package be.ac.ua.comp.projectGPT;
import java.util.Vector;

public class Consumer {
	long mBudget;
	Vector<Job> mJobs = new Vector<Job>();
	Vector<BiddingAgent> mBiddingAgents = new Vector<BiddingAgent>();
	
	
	public void addJob(Job job) {
		mJobs.add(job);
	}
	
	public void depositMoney(int money) {
		mBudget += money;
	}
	
	public void withdrawMoney(int money) {
		assert(mBudget > money);
		mBudget -= money;
	}
	
	public boolean hasMoney(int money) {
		return mBudget > money;
	}
	
	public boolean hasJob() {
		return (mJobs.size() > 0);
	}
	
	public Job chekoutJob() {
		assert(mJobs.size() > 0); //should never be called when there are no jobs, check hasJob if you need to know
		Job job = mJobs.firstElement();
		mJobs.removeElementAt(0);
		return job;
	}
	
	public void removeBiddingAgent(BiddingAgent biddingAgent) {
		mBiddingAgents.remove(biddingAgent);
	}
	
	public EnglishBiddingAgent createEnglishBiddingAgent(EnglishAuctioneer auctioneer, int bid) {
	    EnglishBiddingAgent agent = new EnglishBiddingAgent(bid, this, auctioneer);
	    return agent;
	}


}

